﻿//-----------------------------------------------------------------------
// <copyright file="IChatChannel.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings

using System;
using GateShift.Services.ChatSystem.Backup.Exceptions;

#endregion

namespace GateShift.Services.ChatSystem.Interfaces
{
    /// <summary>
    /// Defines a standard interface for a chat channel
    /// </summary>
    public interface IChatChannel
    {
        /// <summary>
        /// Sets a new channel owner
        /// </summary>
        /// <param name="memberID">Member to promote to the owner</param>
        /// <param name="ownerID">Current owner requesting the change. Use NULL for system command</param>
        void SetChannelOwner(Guid memberID, Guid? ownerID);

        /// <summary>
        /// Sets a password for the channel. Setting password to NULL removes the password.
        /// </summary>
        /// <param name="ownerID">Owner of the channel requesting a new password. Use NULL for system command.</param>
        /// <param name="password">Password to use when joining the channel</param>
        void SetChannelPassword(Guid? ownerID, string password);

        /// <summary>
        /// Adds the specified moderator given another moderator account
        /// </summary>
        /// <param name="memberID">User to add to the Moderator list. If the user is in the list, the request is ignored</param>
        /// <param name="moderatorID">Moderator making the request. NULL should only be used if system is making request.</param>
        void AddModerator(Guid memberID, Guid? moderatorID);

        /// <summary>
        /// Demotes the specified moderator given another moderator account
        /// </summary>
        /// <param name="memberID">User to remove from the Moderator list. If the user is not in the list, the request is ignored</param>
        /// <param name="moderatorID">Moderator making the request. NULL should only be used if system is making request.</param>
        void RemoveModerator(Guid memberID, Guid? moderatorID);

        /// <summary>
        /// Bans the specified user given a moderator account
        /// </summary>
        /// <param name="userID">User to remove from the ban list. If the user is not in the list, the request is ignored</param>
        /// <param name="moderatorID">Moderator making the request. NULL should only be used if system is making request.</param>
        /// <exception cref="InvalidOperationException">Thrown if the user is the owner or the requesting moderator</exception>
        /// <exception cref="SecurityChatChannelException">Thrown if the moderator could not be found</exception>
        void BanMember(Guid userID, Guid? moderatorID);

        /// <summary>
        /// Un-Bans the specified user given a moderator account, but does not add the user to the member list
        /// </summary>
        /// <param name="userID">User to remove from the ban list. If the user is not in the list, the request is ignored</param>
        /// <param name="moderatorID">Moderator making the request. NULL should only be used if system is making request.</param>
        void UnBanMember(Guid userID, Guid? moderatorID);

        /// <summary>
        /// Forces the specified user into the chat channel
        /// </summary>
        /// <param name="requestorID">User to add to the chat channel</param>
        void SystemJoin(Guid requestorID);

        /// <summary>
        /// Joins the specified user to the chat channel as long as they provide the right password
        /// </summary>
        /// <param name="requestorID">User joining the channel</param>
        /// <param name="password">Password used when joining the channel</param>
        /// <exception cref="SecurityChatChannelException">Thrown if the user does not have permission to join the chat channel</exception>
        /// <exception cref="PasswordChatChannelException">Thrown if the password does not match</exception>
        void JoinChannel(Guid requestorID, string password);

        /// <summary>
        /// Makes the specified user leave the chat channel as long as they are not the owner
        /// </summary>
        /// <param name="requestorID">User leaving the channel</param>
        /// <exception cref="InvalidOperationException">Thrown if requestorID is the owner</exception>
        void LeaveChannel(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user is a member of the channel
        /// </summary>
        /// <param name="requestorID">User to check for member role</param>
        /// <returns>Boolean whether or not the specified user is a member</returns>
        bool IsMember(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user is a moderator of the channel
        /// </summary>
        /// <param name="requestorID">User to check for moderator role</param>
        /// <returns>Boolean whether or not the specified user is a moderator</returns>
        bool IsModerator(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user is banned from the channel
        /// </summary>
        /// <param name="requestorID">User to check for banment</param>
        /// <returns>Boolean whether or not the specified user is currently banned</returns>
        bool IsBanned(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user is the owner of the channel
        /// </summary>
        /// <param name="requestorID">User to check for ownership</param>
        /// <returns>Boolean whether or not the specified user is the owner</returns>
        bool IsOwner(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can set a password for the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanSetPassword(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can set an owner for the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanSetOwner(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can delete the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanDelete(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can modify a ban on the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanModifyBan(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can modify a moderator permission for the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanModifyModerator(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can invite a user to the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanInviteMember(Guid requestorID);

        /// <summary>
        /// Returns whether or not the specified user can join the channel
        /// </summary>
        /// <param name="requestorID">User requesting permission</param>
        /// <returns>Boolean whether or not the specified user can perform the action</returns>
        bool CanJoin(Guid requestorID);
    }
}